package 是多少;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-07-15
 * Time: 10:20
 */
class UserNameException extends RuntimeException{
    public UserNameException() {
    }

    public UserNameException(String message) {
        super(message);
    }
}
class PasswordExceptino extends RuntimeException{
    public PasswordExceptino() {
    }

    public PasswordExceptino(String message) {
        super(message);
    }
}
public class LogIn {
    private static String userName = "admin1";
    private static String password = "123456";
    public static void loginInfo(String user,String passwords){
    if (!userName.equals(user)) {
        throw new UserNameException("用户名错误");

    }
if(!password.equals(passwords)) {
    throw new PasswordExceptino("密码错误");

    }
System.out.println("登陆成功");
}
    public static void main(String[] args) {
       try {
           loginInfo("admin", "123456");
       }catch (UserNameException userNameException){
           userNameException.printStackTrace();
       }catch (PasswordExceptino passwordExceptino){
           passwordExceptino.printStackTrace();
       }
    }
}
